package com.dmpp.mes.service.impl;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.dao.OrderMapper;
import com.dmpp.mes.parameterInfo.Order;
import com.dmpp.mes.service.OrderService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "OrderService")

public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper mapper;

    @Override
    public ResponseData findAll(Order order) {
        ResponseData responseData = new ResponseData();
        PageInfo pageInfo = new PageInfo<>(mapper.findAll(order));
        responseData.setData(pageInfo);
        return responseData;
    }


    @Override
    public ResponseData findByOrderNo(String orderNo) {
        ResponseData responseData = new ResponseData();
        responseData.setData(mapper.findByOrderNo(orderNo));
        return responseData;
    }

    @Override
    public ResponseData insert(Order order) {
        ResponseData responseData = new ResponseData();
        mapper.insert(order);
        return responseData;
    }

    @Override
    public ResponseData updateById(Order order) {
        ResponseData responseData = new ResponseData();
        mapper.updateById(order);
        return responseData;
    }

    @Override
    public ResponseData delete(String orderNo) {
        ResponseData responseData = new ResponseData();
        mapper.delete(orderNo);
        return responseData;
    }
}
